import {
  Movie
} from 'class/Movie.js';
var app = getApp();

Page({

  /**
   * 页面的初始数据
   */
  data: {
    movie: {}
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    var movieId = options.id;
    var url = app.globalData.doubanBase +
      "/v2/movie/subject/" + movieId;
    var movie = new Movie(url);
    movie.getMovieData((movie) => {
      // 获取数据完成的回调
      this.setData({
        movie : movie
      })
    });
  },

  // 电影图片点击
  viewMoviePostImg:function(event) {
    var imageUrl = event.currentTarget.dataset.src;
    wx.previewImage({
      urls: [imageUrl],
      current : imageUrl
    })
  }
})